package com.example.demo.jucConcurrent.LockSupport详解;

    class  MyThread extends  Thread {

        public MyThread() {
        }

        public MyThread(Thread currentThread) {
        }

        @Override
        public void run() {
            synchronized (this) {
                System.out.println("Before notify");
                notify();
                System.out.println("after notify");
            }
        }
    }

public class demo01 {
    public static void main(String[] args) {

        MyThread myThread = new MyThread();
        synchronized (myThread){
            try {
                myThread.start();
                //主线程瞬眠3s
                Thread.sleep(3000);
                System.out.println("Before wait");
                //阻塞主线程
                myThread.wait();
                System.out.println("after wait");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
